package com.guzhen.wallpager;

import android.os.Build;
import android.provider.Settings;

import com.fun.funlivewallpaper.AppApplication;

public final class DeviceChecker {
    public static  DeviceChecker instance;

    static {
        DeviceChecker.instance = new DeviceChecker();
    }
    public final boolean isOVOrHuaweiAndCanDrawOverlays() {
        return (this.isOVOrHuawei()) && (Settings.canDrawOverlays(AppApplication.getApplication()));
    }

    public final boolean isHuawei() {
        return (this.isHonorAndReleaseIs_8_1_0()) || (this.isHuaweiAndReleaseIs_8_1_0());
    }


    private final boolean isHonorAndReleaseIs_8_1_0() {
        return (DevicePropertiesHelper.isHonor()) && ("8.1.0".equals(Build.VERSION.RELEASE));
    }
    private final boolean isHuaweiAndReleaseIs_8_1_0() {
        return (RomUtils.isHuawei()) && ("8.1.0".equals(Build.VERSION.RELEASE));
    }
    public final boolean isOVOrHuawei() {
        return (DevicePropertiesHelper.isVivoOrIqoo()) || (DevicePropertiesHelper.isHuawei());
    }


    public final boolean isSpecialDevices() {
        return (this.isHuaweiAndReleaseNot_8_1_0()) || (this.isHonorAndReleaseNot_8_1_0()) || (this.isOppoAndReleaseIs11_10_9_810_8());
    }

    private final boolean isHuaweiAndReleaseNot_8_1_0() {
        return (RomUtils.isHuawei()) && !("8.1.0".equals(Build.VERSION.RELEASE));
    }
    private final boolean isHonorAndReleaseNot_8_1_0() {
        return (DevicePropertiesHelper.isHonor()) && !("8.1.0".equals(Build.VERSION.RELEASE));
    }

    private final boolean isOppoAndReleaseIs11_10_9_810_8() {
        if(RomUtils.isOppo()) {
            String s = Build.VERSION.RELEASE;
            return ("11".equals(s)) || ("10".equals(s)) || ("9".equals(s)) || ("8.1.0".equals(s)) || ("8".equals(s));
        }

        return false;
    }
}